import zipfile

file = './index.rar'


def crack(zFile, toPath, password):
    try:
        zFile.extractall(path=toPath, pwd=password)
        print('succes'+ password)
        return password
    except Exception as e:
        pass
        return


def main():
    zFile = zipfile.ZipFile(file)
    passfile = open('./pass.txt')

    for line in passfile.readline():
        password = line.strip('\n')
        guess = crack(zFile, './output', line)
        if guess:
            print('success：'+password)


if __name__ == '__main__':
    main()
